package com.example.jobback.service.manager.impl;

import com.example.jobback.mapper.CompanyMapper;
import com.example.jobback.mapper.PositionMapper;
import com.example.jobback.result.Result;
import com.example.jobback.service.common.UserCommonService;
import com.example.jobback.service.manager.ManagerDataProfileService;
import com.example.jobback.service.recruiter.RecruiterCrossService;
import com.example.jobback.service.seeker.SeekerCommonService;
import com.example.jobback.service.seeker.SeekerCrossService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName: ManagerDataProfileServiceImpl
 * @Description:数据概览服务接口实现类
 * @Author: lhb
 * @Date: 2025/6/25
 */
@Service
public class ManagerDataProfileServiceImpl implements ManagerDataProfileService {


    private final CompanyMapper companyMapper;

    private final PositionMapper positionMapper;

    private final UserCommonService userCommonService;

    private final RecruiterCrossService recruiterCrossService;

    private final SeekerCrossService seekerCrossService;

    public ManagerDataProfileServiceImpl(UserCommonService userCommonService,
                                         CompanyMapper companyMapper,
                                         PositionMapper positionMapper,
                                         RecruiterCrossService recruiterCrossService,
                                         SeekerCrossService seekerCrossService) {
        this.userCommonService = userCommonService;
        this.companyMapper = companyMapper;
        this.positionMapper = positionMapper;
        this.recruiterCrossService = recruiterCrossService;
        this.seekerCrossService = seekerCrossService;
    }

    /**
     * @Description: 获取总用户数
     * @return Result<Object>
     * @Author lhb
     * @CreateTime 2025/6/25 10:22
     */
    @Override
    public Result<Object> getAllUserNum() {
        Long num=userCommonService.getAllUserNum();
        return Result.success(num);
    }

    /**
     * @Description: 获取企业数
     * @return Result<Object>
     * @Author lhb
     * @CreateTime 2025/6/25 10:22
     */
    @Override
    public Result<Object> getCompanyNum() {
        Long num = recruiterCrossService.getCompanyNum();
        return Result.success(num);
    }

    /**
     * @Description: 获取活跃岗位数
     * @return Result<Object>
     * @Author lhb
     * @CreateTime 2025/6/25 10:27
     */
    @Override
    public Result<Object> getActivePositions() {
        Long num = recruiterCrossService.getActivePositions();
        return Result.success(num);
    }

    /**
     * @Description: 获取简历投递数
     * @return Result<Object>
     * @Author lhb
     * @CreateTime 2025/6/25 10:32
     */
    @Override
    public Result<Object> getResumeDelivers() {
        Long num = seekerCrossService.getResumeDelivers();
        return Result.success(num);
    }
}
